<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>oscP5 : : OscProperties</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="stylesheet.css" rel="stylesheet" type="text/css">
<script type="text/javascript">
document.getElementsByTagName('html')[0].className = 'isjs';

function toggle(dt) 
{ 
  var display, dd=dt; 
  /* get dd */ 
  do{ dd = dd.nextSibling } while(dd.tagName!='DD'); 
  toOpen =!dd.style.display; 
  dd.style.display = toOpen? 'block':'' 
  dt.getElementsByTagName('span')[0].innerHTML 
    = toOpen? '-':'+' ; 
} 
</script>
</head>
<body>
<div id="container">
		<div id="header">
		<a href="./index.htm"><img src="./docuImages/title.jpg" /></a>
		</div>
	<div class="content">
		<h1>OscProperties</h1>
		<dl><dt class="key">description</dt><dd class="value">osc properties are used to start oscP5 with more specific settings.
 osc properties have to be passed to oscP5 in the constructor when
 starting a new instance of oscP5.</dd></dl>
			
			<div class="toggleList example">
				<dl><dt onclick="toggle(this)"><span>+</span>Example</dt>
					<dd><pre>/**
 * oscP5properities by andreas schlegel
 * example shows how to use osc properties. 
 * if you need more specific settings for your osc session,
 * osc properties serves your needs.
 * oscP5 website at http://www.sojamo.de/oscP5
 */
import oscP5.*;
import netP5.*;

OscP5 oscP5;

void setup() {
  size(400,400);
  frameRate(25);

  /* create a new osc properties object */
  OscProperties properties = new OscProperties();
  
  /* set a default NetAddress. sending osc messages with no NetAddress parameter 
   * in oscP5.send() will be sent to the default NetAddress.
   */
  properties.setRemoteAddress("127.0.0.1",12000);
  
  /* the port number you are listening for incoming osc packets. */
  properties.setListeningPort(12000);
  
  
  /* Send Receive Same Port is an option where the sending and receiving port are the same.
   * this is sometimes necessary for example when sending osc packets to supercolider server.
   * while both port numbers are the same, the receiver can simply send an osc packet back to
   * the host and port the message came from.
   */
  properties.setSRSP(OscProperties.ON);
  
  /* set the datagram byte buffer size. this can be useful when you send/receive
   * huge amounts of data, but keep in mind, that UDP is limited to 64k
  */
  properties.setDatagramSize(1024);
  
  /* initialize oscP5 with our osc properties */
  oscP5 = new OscP5(this,properties);    
  
  /* print your osc properties */
  println(properties.toString());
}



void mousePressed() {
  /* create a new osc message with address pattern /test */
  OscMessage myMessage = new  OscMessage("/test");
  myMessage.add(200);
  
  /* send the osc message to the default netAddress, set in the OscProperties above.*/
  oscP5.send(myMessage);
}


void draw() {
  background(0);  
}



/* incoming osc message are forwarded to the oscEvent method. */
void oscEvent(OscMessage theOscMessage) {
  /* print the address pattern and the typetag of the received OscMessage */
  print("### received an osc message.");
  print(" addrpattern: "+theOscMessage.addrPattern());
  println(" typetag: "+theOscMessage.typetag());
}
</pre></dd>
				</dl>
			</div>
			
			
			
			<dl><dt class="key">constructors</dt><dd class="value"><pre>OscProperties(theParent);
OscProperties();
</pre></dd></dl>
			
			
			
			
			
			
			
			<!-- METHODS:BEGIN -->
			
       <dl class="noborder"><dt>Methods</dt></dl>
       <dl><dt class="key"><a href="oscproperties_method_datagramsize.htm">datagramSize ( )</a></dt><dd class="value">returns the current size of the datagram bytebuffer.</dd></dl>
<dl><dt class="key"><a href="oscproperties_method_listeningport.htm">listeningPort ( )</a></dt><dd class="value">returns the port number currently used to receive osc packets.</dd></dl>
<dl><dt class="key"><a href="oscproperties_method_networkprotocol.htm">networkProtocol ( )</a></dt><dd class="value">returns the network protocol being used to transmit osc packets. returns an int.
 0 (UDP), 1 (MULTICAST), 2 (TCP)</dd></dl>
<dl><dt class="key"><a href="oscproperties_method_remoteaddress.htm">remoteAddress ( )</a></dt><dd class="value">returns a NetAddress of the remote host you are sending
 osc packets to. by default this is null.</dd></dl>
<dl><dt class="key"><a href="oscproperties_method_setdatagramsize.htm">setDatagramSize ( )</a></dt><dd class="value">set the size of the datagrampacket byte buffer.
 the default size is 1536 bytes.</dd></dl>
<dl><dt class="key"><a href="oscproperties_method_seteventmethod.htm">setEventMethod ( )</a></dt><dd class="value">set the name of the default event method.
 the event method is the method to which incoming osc messages
 are forwarded. the default name for the event method is
 "oscEvent"</dd></dl>
<dl><dt class="key"><a href="oscproperties_method_setlisteningport.htm">setListeningPort ( )</a></dt><dd class="value">set port number you are listening for incoming osc packets.</dd></dl>
<dl><dt class="key"><a href="oscproperties_method_setnetworkprotocol.htm">setNetworkProtocol ( )</a></dt><dd class="value">set the network protocol over which osc messages are transmitted.
 options are OscProperties.UDP and OscProperties.MULTICAST
 the network protocol can only be set before initializing
 oscP5.</dd></dl>
<dl><dt class="key"><a href="oscproperties_method_setremoteaddress.htm">setRemoteAddress ( )</a></dt><dd class="value">set the remote host address. set ip address and port of the host
 message should be sent to.</dd></dl>
<dl><dt class="key"><a href="oscproperties_method_setsrsp.htm">setSRSP ( )</a></dt><dd class="value">SRSP stand for Send and Receive on Same Port.
 by default osc packets are not received and sent by the same port.
 if you need to send and receive on the same port call
 setSRSP(OscProperties.ON)</dd></dl>
<dl><dt class="key"><a href="oscproperties_method_srsp.htm">srsp ( )</a></dt><dd class="value">you can send and receive at the same port while on a udp con</dd></dl>
<dl><dt class="key"><a href="oscproperties_method_tostring.htm">toString ( )</a></dt><dd class="value">prints out the current osc properties settings.</dd></dl>

   
			<!-- METHODS:END -->
			<div class="separator">
			<dl><dt class="key">usage</dt><dd class="value">Web & Application</dd></dl>
			</div>
			<div class="separator">
			<dl><dt class="key">related</dt><dd class="value"><ul><li><a href="oscp5_class_oscp5.htm">OscP5</a></li>
</ul></dd></dl>
			</div>
	</div>
	<div id="footer">
	<p>by andreas schlegel (<a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/" target="_blank">cc</a>) 2007, <a href="http://www.sojamo.de" target="_blank">sojamo</a>.</p>
	</div>
</div>
</body>
</html>


